Linux Commands For DevOps
Linux Basic commands
date Show the current date and time
cal Show this month's calendar
uptime Show current uptime
whoami Who you are logged in as
finger Display information about user
users / id Shows user information
man Shows manual of command
username Shows your user name
who / w Display who is online
View files
ls Directory listing
cat filename View file content
less View a file page by page
more Output the contents of file
head Output the first 10 lines of file
tail Output the last 10 lines of file
page Display file page by page
Create & Delete file/directory
touch Create a 0 bites file
cat > filename Create file and allow to write
nano Create a file if filename doesn’t exist
vi Create a file if filename doesn’t exist
rm Remove a file
mkdir Create a directory
rmdir Remove a empty directory
rm -rf Remove a directory
Managing files or directories
cp Copy a file
mv Move a file
find Find a file
grep Search for a pattern in a file
cd Switch between directories
diff Find content difference in 2 files
sed Search and replace particular pattern
chmod Change file permissions
chown Change Ownership of a file
file Show what kind of file it is
System Management
history List all commands executed by a user
free Free memory of a server
/proc/meminfo Displays memory information
/proc/cpuinfo Displays CPU information
uname -a Show kernel information
du Show directory space usage
whereis Show possible locations of app
which Show which app will be run by default
Networking
hostname Lists host name of the server
ping <ip> Availability of destination server over the network
wget Download packages/softwars onto Linux system
ifconfig Lists IP address(es) of the server
telnet Connect to remote host / check port availability status
curl Acces the application as from browser
Process Management
ps -ef List the process which are running in the system
kill / kill -9 Kill a process or service
fg Run the program in the foreground
bg Run the service in the back group
top List top 20 process which are consuming more CPU
Archiving files or directories
gzip Create a compressed file
gunzip Unzip a file
tar Extract tar file